package cn.akwangl.controller;

import cn.akwangl.common.Result;
import cn.akwangl.user.INews;
import cn.akwangl.user.IUserService;
import com.alibaba.dubbo.config.annotation.Reference;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户服务API.
 *
 * @author youyongkun
 * @date 2021/10/26 15:31
 */
@Api(tags = "用户服务API")
@RestController("/user")
public class UserController {
    @Reference(url = "dubbo://localhost:20890")
    private IUserService userService;

    @Reference(url = "dubbo://localhost:20890")
    private INews inews;

    /**
     * hello.
     *
     * @author youyongkun
     * @date 2021/10/26 15:39
     */
    @ApiOperation(value = "hello")
    @GetMapping("/hello")
    public Result<String> hello() {
        return Result.ok(userService.hello());
    }

    /**
     * hello.
     *
     * @author youyongkun
     * @date 2021/10/26 15:39
     */
    @ApiOperation(value = "hello2")
    @GetMapping("/hello2")
    public Result<String> hello2() {
        return Result.ok(inews.content());
    }

}
